package com.lbw.controller;


import com.lbw.entity.QuestionEntity;
import com.lbw.entity.WrongEntity;
import com.lbw.result.Result;
import com.lbw.result.ResultFactory;
import com.lbw.service.WrongEntityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lbw
 * @since 2020-09-13
 */
@RestController
@RequestMapping("/wrongEntity")
@Api(tags = "错误题目")
public class WrongEntityController {

    @Autowired
    private WrongEntityService wrongEntityService;


    /**
     * 查询出本学生的错题
     * @param stuId 学生id
     * @param keyWord 搜索关键字
     * @return
     */
    @PostMapping("/selectQuestionByChapterAndSubject")
    @ApiOperation("查询出本学生的错题")
    public Result selectWrongByStu(@RequestParam("stuId") String stuId,@RequestParam(value = "keyWord",required = false) String keyWord) {
        List<WrongEntity> wrongEntityList = wrongEntityService.selectWrongByStu(stuId,keyWord);
        return ResultFactory.success(wrongEntityList);
    }


}

